package com.ruoyi.business.listener;

import com.ruoyi.business.domain.FileIntranetExport;
import com.ruoyi.business.namage.FileExportManager;
import com.ruoyi.business.service.IFileIntranetExportService;
import com.ruoyi.common.utils.spring.SpringUtils;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;

/**
 * 流程执行监听器
 */
public class FileIntranetExportListener implements ExecutionListener {

    @Override
    public void notify(DelegateExecution delegateExecution) {
        IFileIntranetExportService intranetExportService = SpringUtils.getBean(IFileIntranetExportService.class);
        FileExportManager exportManager = SpringUtils.getBean(FileExportManager.class);
        String businessKey = delegateExecution.getProcessInstanceBusinessKey();
        FileIntranetExport fileIntranetExport = intranetExportService.selectFileIntranetExportById(Long.valueOf(businessKey));//获取导出信息
        exportManager.intranetExport(fileIntranetExport);
    }
}
